package com.naire.modul.answer_sort.service;

import net.common.manager.SystemCodeManager;
import net.common.service.GeneralService;
import com.naire.modul.answer_sort.dao.Answer_sortDao;
import com.naire.modul.answer_sort.dao.impl.Answer_sortDaoImpl;
import com.naire.modul.answer_sort.vo.Answer_sortVo;

/**
 * 
 * 
 * @author Administrator
 * 
 */
public class Answer_sortEditorService extends GeneralService {

	private Answer_sortVo bean;
	private String parent_code;

	@Override
	public void execute() throws Exception {
		Answer_sortDao dao = new Answer_sortDaoImpl();
		if (bean.getAnswer_sort_id() != null) {
			dao.update(bean);
		} else {
			bean.setFlag(0);
			if(parent_code != null && !parent_code.equals("")) {
				bean.setParent_num(parent_code);
			}
			bean.setAnswer_num(SystemCodeManager.createCode("0008", parent_code));
			dao.insert(bean);
		}
	}

	public void setBean(Answer_sortVo bean) {
		this.bean = bean;
	}

	public void setParent_code(String parent_code) {
		this.parent_code = parent_code;
	}

}
